<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="" />
<link rel="stylesheet" href="../css/main.css" type="text/css" />
<link href="../css/themes/default.css" rel="stylesheet" type="text/css"/>
<link href="../css/themes/mac_os_x.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript" src="../js/scriptaculous.js"></script>
<script type="text/javascript" src="../js/controls.js"></script>
<script type="text/javascript" src="../js/window.js"></script>
<script type="text/javascript" src="../js/window_effects.js"></script>
<script type="text/javascript" src="../js/page.js"></script>
<script type="text/javascript">
var op = null;
function stat(tipo){
	var url = "stat_create.php";
	if(tipo == 1)
		url += "?t=1&classe="+$('classe').value;
	else if(tipo == 2)
		url += "?t=2&sezione="+$('sezione').value;
	
	op = new Window({id: "op", className: "mac_os_x",  width:250, height: 100, zIndex: 100, resizable: true, title: "Creazione statistiche", url: url, showEffect:Effect.Appear, hideEffect: Effect.Fade, draggable:true, wiredDrag: true});
	op.showCenter(true);

	/*
	var url = "http://www.inrich.it/admin/stat_create.php";
    req = new Ajax.Request(url,
			  {
			    	method:'post',
			    	parameters: $('stat_form').serialize(true),
			    	onSuccess: function(transport){
			    		var response = transport.responseText || "no response text";
			    		alert(response);
			    		dati = response.split(";");
			    		if($dati[0] == "ko"){
			    			alert("Errore SQL. \nQuery: "+dati[1]+"\nErrore: "+dati[2]);
			    			return;
			    		}
			    		alert(response);
			    	},
			    	onFailure: function(){ alert("Si e' verificato un errore...") }
			  });
	  */
}

function chiudi(){
	//Windows.close("op", event);
	op.close();
}
</script>
<title>Registro elettronico</title>
</head>
<body>
    <div id="header">
		<div class="wrap">
			<?php include "header.php" ?>
		</div>
	</div>
	<div class="wrap">
	<div id="main" style="background-color: #FFFFFF; padding-bottom: 30px; width: 100%">
    <form action="stat_create.php" method="post" id="stat_form">
        <table width="80%" style="margin-right: auto; margin-left: auto">
            <tr>
                <td style="font-weight: bold" colspan="2" align="center">Creazione statistiche di rendimento</td>
            </tr>
            <tr>
                <td colspan="2" style="padding-bottom: 50px">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td style=" width: 30%; height: 40px"><a href="#" onclick="stat(0)">Crea statistiche complete</a></td>
                <td style="color: #003366; height: 40px">
                    <a href="#" onclick="stat(0)">Crea le statistiche complete per tutta la scuola, relative all'ultimo scrutinio in archivio...</a>
                </td>
            </tr>
            <tr>
                <td style="width: 30%; height: 40px"><a href="#" onclick="stat(1)">Crea statistiche per la classe... </a></td>
                <td style="color: #003366; height: 40px">
                    <select name="classe" style="width: 400px; font-size: 11px;" id="classe">
                    <?php 
                    while($c = $res_classi->fetch_assoc()){
                    ?>
                    	<option value="<?php print($c['id_classe']) ?>"><?php print $c['anno_corso'].$c['sezione'] ?></option>
                    <?php 
                    }
                    ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 30%; height: 40px"><a href="#" onclick="stat(2)">Crea statistiche per la sezione...</a></td>
                <td style="color: #003366; height: 40px">
                	<select name="sezione" style="width: 400px; font-size: 11px;" id="sezione">
                    <?php 
                    while($s = $res_sezioni->fetch_assoc()){
                    ?>
                    	<option value="<?php print($s['sezione']) ?>">Sezione <?php print $s['sezione'] ?></option>
                    <?php 
                    }
                    ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <a href="/admin/index.php">Torna al menu</a>
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;&nbsp;&nbsp;<input type="hidden" name="t" /></td>
            </tr>
        </table>
    </form>
    </div>	
	<div id="footer">
		<p>Design: Luka Cvrk - <a href="http://www.solucija.com" title="Free Web Templates">Solucija</a></p>
	</div>
	</div>		
</body>
</html>